package bean; //打包	

public class Stringtonum {
	private double num1; 
	private double num2;
	private double num3;

	public Stringtonum() {
		// 无参构造函数
	}

	public double getNum1() {
		return num1;
	}

	public double getNum2() {
		return num2;
	}

	public double getNum3() {
		return num3;
	}

	public void setNum1(double n) {
		num1 = n;
	}

	public void setNum2(double n) {
		num1 = n;
	}

	public void setNum3(double n) {
		num1 = n;
	}

	public boolean strtonum(String str) { //取三个边
		double a[] = new double[3];
		int i;
		if (str == null)
			return false;
		String substr = ",";
		String[] as = str.split(substr); // 字符串分割
		if (as.length != 3) {
			return false;
		} else {
			for (i = 0; i < 3; i++) {
				// a[i]=Double.valueOf(as[i]).doubleValue();
				a[i] = Double.valueOf(as[i]);
			}
		}
		num1 = a[0];
		num2 = a[1];
		num3 = a[2];
		if (num1 < 0.0 || num2 < 0.0 || num3 < 0.0)
			return false;
		return true;
	}
}
